<?php

use admin\models\Category;
use yii\db\Migration;

/**
 * import init data
 */
class m210905_191800_product extends Migration
{

    /**
     * @return bool|void
     */
    public function down()
    {
        $this->dropColumn('{{%product}}', 'category_id');
        $this->dropColumn('{{%product}}', 'model');
        $this->dropColumn('{{%product}}', 'sub_model');
    }

    /**
     * @return bool|void
     */
    public function up()
    {
        $this->addColumn('{{%product}}', 'category_id', $this->bigInteger()->unsigned()->notNull()->defaultValue(0)->comment('分类 ID')->after('id'));
        $this->addColumn('{{%product}}', 'model', $this->string()->notNull()->defaultValue('')->comment('型号')->after('title'));
        $this->addColumn('{{%product}}', 'sub_model', $this->string()->notNull()->defaultValue('')->comment('子型号')->after('model'));
    }
}
